

/**
 * Class representing the output neurons used to guess the mood of the face. 
 * Override the error computation in order to use the expected value rather than the common formula
 */
public class OutputNeuron extends AbstractNeuron {
	
	public static final double ACTIVATION_TRESHOLD = 0.6;
	
	private double expectedValue;
	public String name; // DEBUG
	
	public OutputNeuron(String name) {
		super();
		this.name = name;
	}
	
	@Override
	protected double activationFunction(double e) {
		return 1 / (1 + Math.exp(-1 * e ));
	}

	@Override
	protected double activationFunctionDerivative(double e) {
		return value * (1 - value);
	}
	
	public void setExpectedValue(double expectedValue) {
		this.expectedValue = expectedValue;
	}

	@Override
	public void computeError() {
		error = expectedValue - value;
	}
	
	public boolean isActivated() {
		return value >= ACTIVATION_TRESHOLD;
	}
	

}
